#include "modelchooseitem.h"
#include "ui_modelchooseitem.h"

ModelChooseItem::ModelChooseItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ModelChooseItem)
{
    ui->setupUi(this);

    setStyleSheet("border: 1px solid rgb(211, 211, 211);"
                  "border-radius: 3px;"
                  "background: rgb(255, 255, 255);");

    ui->radioButton->setStyleSheet("border: none;");
    ui->label->setStyleSheet("border: none;");
}

ModelChooseItem::~ModelChooseItem()
{
    delete ui;
}

void ModelChooseItem::initRatioButton(int count)
{
    switch (count) {
    case 1:
        ui->radioButton->setText("模版一");
        break;
    case 2:
        ui->radioButton->setText("模版二");
        break;
    case 3:
        ui->radioButton->setText("模版三");
        break;
    case 4:
        ui->radioButton->setText("模版四");
        break;
    case 5:
        ui->radioButton->setText("模版五");
        break;
    case 6:
        ui->radioButton->setText("模版六");
        break;
    }
}

void ModelChooseItem::initPicture()
{
    QPixmap pixmap(":/action/images/model.png");
    pixmap = pixmap.scaled(ui->label->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->label->setPixmap(pixmap);
}

QRadioButton* &ModelChooseItem::getButton()
{
    return ui->radioButton;
}
